const { Model, DataTypes, Deferrable } = require("sequelize");
const { sequelize } = require('../db/index.js');
class User extends Model {}
User.init({
    id: {
        type: DataTypes.UUID,
        primaryKey: true,
        defaultValue: DataTypes.UUIDV4,
        comment: '用户id'
    },
    name: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        comment: '用户名'
    },
    password: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '用户密码'
    },
    email: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        comment: '用户邮箱'
    },
}, {
    sequelize,
    timestamps: true,
    underscored: true,
    freezeTableName: true,
});
// User.sync({ alter: true });
module.exports = User;